#ifndef HTTP_HANDLE_H
#define HTTP_HANDLE_H
#include "lua.hpp"
#include "defin.h"
#include "response.h"
class http_handle
{
public:
    http_handle(short &req_type, std::string &req_url,
                http_head &head, http_param &param,
                char *req_body, int req_body_len);
    ~http_handle();

    //初始化
    bool init();

    //处理
    bool process();

    //获取respones
    http_respones &get_respones();

private:
    bool call_urls();

private:
    lua_State *m_Lua;
    //http协议头
    http_head m_map_head;
    //请求参数
    http_param m_map_param;
    //请求类型
    short m_req_type;
    //请求url
    std::string m_req_url;
    //请求内容长度
    int m_req_body_len;
    //请求内容
    char *m_req_body;

    //请求结果
    http_respones m_respones;
};
#endif